home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Think Class Libraries / SAT-TCL 1.0b2 / SAT-TCL ƒ / SATTCLIntf.p < prev   
Encoding:
Text File  |  1996-06-08  |  7.2 KB  |  205 lines  |  [TEXT/PJMM]

  1. {****************************************************}
  2. {}
  3. {    SATTCLIntf.p                                                                                                }
  4. {}
  5. {    Interface file for the classes by which the THINK Class Library can be used    }
  6. {    with the Sprite Animation Toolkit.                                                                 }
  7. {}
  8. {    The interface is deliberately kept minimal, making TCL work with SAT,            }
  9. {    rather than the other way around. Commands to SAT are activated using         }
  10. {    the usual SAT* type commands. Sprites are treated in the same way as             }
  11. {    for other SAT projects.                                                                                    }
  12. {}
  13. {    SAT-TCL                                                                                                        }
  14. {    Copyright © 1995 by Patrick C Hew. All rights reserved.                                }
  15. {    Use of this package follows the same restrictions as for SAT.                        }
  16. {}
  17. {    Sprite Animation Toolkit                                                                                                                                                                    }
  18. {    Copyright © 1992-1994 by Ingemar Ragnemalm. All rights reserved.            }
  19. {    See documentation for licensing details and the restrictions on use.                }
  20. {}
  21. {    THINK Class Library                                                                                                                                                                                }
  22. {    Copyright © 1989 by Symantec Corporation.  All rights reserved.                    }
  23. {}
  24. {    Revision History:                                                                                            }
  25. {}
  26. {    Version:    1.00b1 for TCL 1.1.2 and SAT 2.3b4                                                }
  27. {    Date:         20 December 1995                                                                        }
  28. {    Author:        Patrick C Hew     <phew@ucc.gu.uwa.edu.au>                                    }
  29. {    Notes:        Initial release - CSATDirector and CSATPane .                                }
  30. {}
  31. {    Version:    1.00b2 for TCL 1.1.2 and SAT 2.3b4                                                }
  32. {    Date:        10 Jun 1996                                                                                    }
  33. {    Author:        Patrick C Hew    <phew@ucc.gu.uwa.edu.au>                                    }
  34. {    Notes:        Integrated with Game Classes in a more useful framework.            }
  35. {                    CSATWindow .                                                                                }
  36. {}
  37. {    To Do:                                                                                                            }
  38. {    1)    Investigate scrolling more closely, when combined with Zooming of            }
  39. {        windows. Currently gives strange results.                                                    }
  40. {    2)    Override Update for CSATWindow so that it calls SATDepthChangeTest,        }
  41. {        and does something useful.                                                                            }
  42. {}
  43. {****************************************************}
  44.  
  45.  
  46. unit SATTCLIntf;
  47.  
  48. interface
  49.  
  50.     uses
  51.         TCL, SAT;
  52.  
  53.  
  54. {****************************************************}
  55. {}
  56. {    CSATDirector                                                                                                }
  57. {}
  58. {    Director class for use with the Sprite Animation Toolkit. This class is            }
  59. {    minimalist, since it is quite game dependant.                                                    }
  60. {}
  61. {    Important: Only one instance of this class should exist, namely the director    }
  62. {    which supervises the window containing CSATPane. Remember that SAT is    }
  63. {    designed for a single rectangle of animation in a single window.                        }
  64. {}
  65. {****************************************************}
  66.  
  67.     type
  68.         CSATDirector = object(CDirector)
  69.  
  70.                 itsSATPane: CSATPane;
  71.  
  72.                 { Initializes a SAT Director object. }
  73.                 procedure ISATDirector (aSupervisor: CApplication);
  74.  
  75.                 { Free the SAT Director class, and close down any sounds. This is a good }
  76.                 { place to delete any sprites and sounds which you have created. }
  77.                 procedure Free;
  78.                 override;
  79.  
  80.                 { In this method, you should build the SAT Pane and SAT Window as }
  81.                 { you want them. You should then send a SetSATPane message to }
  82.                 { the window with the SAT Pane. Doing so will initialize SAT, after }
  83.                 { which you can create sprites and sounds as you desire. }
  84.                 procedure BuildWindow;
  85.  
  86.             end; { CSATDirector }
  87.  
  88.  
  89. {****************************************************}
  90. {}
  91. {    CSATPane                                                                                                        }
  92. {}
  93. {    Panorama class for use with the Sprite Animation Toolkit. This basically        }
  94. {    calls SATCustomInit to set up the animation area, and implements it in a        }
  95. {    panorama.                                                                                                        }
  96. {}
  97. {    The bounds of the panorama are the rectangle specified to SAT. The other         }
  98. {    parameters are as per SAT. We ignore the options for centering the drawing    }
  99. {    area and filling the screen, since these are handled by the window class and     }
  100. {    the decorator class (if used).                                                                            }
  101. {}
  102. {    Important: Only one instance of this class should exist. This is where SAT        }
  103. {    thinks that its drawing area is.                                                                        }
  104. {}
  105. {****************************************************}
  106.  
  107.     {    Synonyms for some of the parameters. }
  108.  
  109.     const
  110.         kUseMenuBar = TRUE;
  111.         kNoUseMenuBar = FALSE;
  112.         kDither4Bit = TRUE;
  113.         kNoDither4Bit = FALSE;
  114.         kBeSmart = TRUE;
  115.         kNoBeSmart = FALSE;
  116.  
  117.     type
  118.         CSATPane = object(CPanorama)
  119.  
  120.                 { Initialize a SAT Pane class, and SAT. The drawing area for SAT specifies }
  121.                 { the bounds of the panorama. }
  122.                 procedure ISATPane (anEnclosure: CView;
  123.                                             aSupervisor: CBureaucrat;
  124.                                             aWidth, aHeight, aHEncl, aVEncl: Integer;
  125.                                             aHSizing, aVSizing: SizingOption;
  126.                                             aPICTColor, aPICTBW: Integer;
  127.                                             aSATRect: Rect;
  128.                                             aUseMenuBar, aDither4bit, aBeSmart: Boolean);
  129.  
  130.                 { TCL wants to draw the SAT pane. So draw it, as described in the manual. }
  131.                 { We don't use SATRedraw because we don't want the black bars. }
  132.                 procedure Draw (var area: Rect);
  133.                 override;
  134.  
  135.                 { Call SATRun for one frame of animation, with the given fast parameter. }
  136.                 { SAT expects that its onscreen drawing area (the frame of the SAT Pane) }
  137.                 { is valid. However, we can't just call ValidRect with the frame, because }
  138.                 { there may be a updateEvt pending for the window. }
  139.                 { The cunning bit of subterfuge implemented here is to copy the update }
  140.                 { region of the window into a temporary region, validate the frame for }
  141.                 { SATRun, and then copy the region back so that the window's Update }
  142.                 { method can work as normal. }
  143.                 procedure DoSATRun (fast: Boolean);
  144.  
  145.                 { Call SATRun2 for one frame of animation, with the given fast parameter. }
  146.                 { SAT expects that its onscreen drawing area (the frame of the SAT Pane) }
  147.                 { is valid. However, we can't just call ValidRect with the frame, because }
  148.                 { there may be a updateEvt pending for the window. }
  149.                 { The cunning bit of subterfuge implemented here is to copy the update }
  150.                 { region of the window into a temporary region, validate the frame for }
  151.                 { SATRun, and then copy the region back so that the window's Update }
  152.                 { method can work as normal. }
  153.                 procedure DoSATRun2 (fast: Boolean);
  154.  
  155.             end; { CSATPane }
  156.  
  157.  
  158. {****************************************************}
  159. {}
  160. {    CSATWindow                                                                                                    }
  161. {}
  162. {    Window class for use with the Sprite Animation Toolkit. The rationale is        }
  163. {    that a single instance of this class contains the SAT Pane.                                }
  164. {}
  165. {    This class takes care of the SATWindMoved calls, informing SAT that the        }
  166. {    window containing its drawing area has moved.                                                }
  167. {}
  168. {****************************************************}
  169.  
  170.     type
  171.         CSATWindow = object(CWindow)
  172.  
  173.                 { Points to the single instance of the SAT Pane. }
  174.                 itsSATPane: CSATPane;
  175.  
  176.                 { Initializes a SAT Window object. }
  177.                 procedure ISATWindow (WINDid: Integer;
  178.                                             aFloating: Boolean;
  179.                                             anEnclosure: CDesktop;
  180.                                             aSupervisor: CDirector);
  181.  
  182.                 { For completeness, reset our pointer to the SAT Pane. }
  183.                 procedure Free;
  184.                 override;
  185.  
  186.                 { Call this to install the SAT Pane. }
  187.                 procedure InstallSATPane (aSATPane: CSATPane);
  188.  
  189.                 { After dragging, call SAT. }
  190.                 procedure Drag (macEvent: EventRecord);
  191.                 override;
  192.  
  193.                 { After moving, call SAT. }
  194.                 procedure Move (hGlobal, vGlobal: integer);
  195.                 override;
  196.  
  197.                 { After moving offscreen, call SAT. }
  198.                 procedure MoveOffScreen;
  199.                 override;
  200.  
  201.             end; { CSATWindow }
  202.  
  203. implementation
  204.  
  205. end. { SATTCLIntf }